package cn.johnyu.springboot_primer;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@EnableAutoConfiguration
public class Example {
	@ResponseBody
	@RequestMapping(value="/",method=RequestMethod.GET)
	User home() {
		User u=new User();
		u.setAge(23);
		u.setUname("john");
		u.setId(12);
		return u;
	}
	@ResponseBody
	@RequestMapping(value="/users.do",method=RequestMethod.POST)
	User findUser(@RequestBody User u) {
		
		return u;
	}

	public static void main(String[] args) throws Exception {
		SpringApplication.run(Example.class, args);
	}
}